app.controller("aController",function($scope, $http){
  function getCookie(cookie_name){
           var allcookies = document.cookie;
           var cookie_pos = allcookies.indexOf(cookie_name);
           if (cookie_pos != -1){
               cookie_pos += cookie_name.length + 1;  
           var cookie_end = allcookies.indexOf(";", cookie_pos);
           if (cookie_end == -1){cookie_end = allcookies.length;} 
           var value = unescape(allcookies.substring(cookie_pos, cookie_end));}
           return value;
           }
           // console.log(getCookie("key"))
          var cookie_val = getCookie("token");
  $scope.cookie_val={id:cookie_val};
  $http({
        method: 'POST',
        url: '/OA/staff/query',
        data: $.param($scope.cookie_val),
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }).success(function (response){
    	 if (response.ok==true) {
        $scope.items=response.data;
       };     
    });
    // 修改数据
    // $scope.addUser = function () { 
    //         console.log(cookie_val)
    //         var  username=angular.element(document.querySelector('#username')).val(); 
    //         var  birthday=angular.element(document.querySelector('#time')).val();
    //         var  telephone=angular.element(document.querySelector('#telephone')).val(); 
    //         var  WeChat=angular.element(document.querySelector('#telephone')).val();
    //         var  QQ=angular.element(document.querySelector('#QQ')).val();
    //         $scope.userJson={username:username,phone:telephone,weChat:WeChat,qq:QQ,birthday:birthday};
    //        $http({
    //           method: 'POST',
    //           url: 'api/staff/updateMine',
    //           data: $.param($scope.userJson),
    //           headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    //        }).success(function (response){
    //               if(response.ok==true){
    //                   console.log(response);
    //                   $scope.items = response.data;
    //               }
    //            });


    // }
})